{% extends "base.html" %}

{% block title %}车辆管理 - 车辆管理系统{% endblock %}

{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">
    <h2>车辆管理</h2>
    <a href="{{ url_for('admin_dashboard') }}" class="btn btn-secondary">返回控制台</a>
</div>

<div class="card">
    <div class="card-header">
        <h5 class="mb-0">所有注册车辆</h5>
    </div>
    <div class="card-body">
        {% if vehicles %}
            <div class="table-responsive">
                <table class="table table-striped" id="vehicles-table">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>车牌号</th>
                            <th>车辆类型</th>
                            <th>颜色</th>
                            <th>所有人</th>
                            <th>注册时间</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for vehicle in vehicles %}
                            <tr>
                                <td>{{ vehicle.id }}</td>
                                <td>{{ vehicle.plate_number }}</td>
                                <td>{{ vehicle.vehicle_type }}</td>
                                <td>{{ vehicle.color }}</td>
                                <td>{{ vehicle.owner_name }}</td>
                                <td>{{ vehicle.created_at.strftime('%Y-%m-%d %H:%M:%S') }}</td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        {% else %}
            <p class="text-center text-muted">暂无注册车辆</p>
        {% endif %}
    </div>
</div>
{% endblock %}

{% block extra_js %}
<script>
    // 可以添加表格排序、过滤等功能
    document.addEventListener('DOMContentLoaded', function() {
        // 初始化表格功能
    });
</script>
{% endblock %} 